home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows (5th Edition) / Programming Windows, 5th ed. - Companion CD (097-0002183)(1999).iso / Chap17 / FontOut1 / FontOut1.c next >
Encoding:
C/C++ Source or Header  |  1998-10-09  |  1004 b   |  34 lines

  1. /*------------------------------------------
  2.    FONTOUT1.C -- Using Path to Outline Font
  3.                  (c) Charles Petzold, 1998
  4.   ------------------------------------------*/
  5.  
  6. #include <windows.h>
  7. #include "..\\eztest\\ezfont.h"
  8.  
  9. TCHAR szAppName [] = TEXT ("FontOut1") ;
  10. TCHAR szTitle [] = TEXT ("FontOut1: Using Path to Outline Font") ;
  11.  
  12. void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
  13. {
  14.      static TCHAR szString [] = TEXT ("Outline") ;
  15.      HFONT        hFont ;
  16.      SIZE         size ;
  17.  
  18.      hFont = EzCreateFont (hdc, TEXT ("Times New Roman"), 1440, 0, 0, TRUE) ;
  19.  
  20.      SelectObject (hdc, hFont) ;
  21.  
  22.      GetTextExtentPoint32 (hdc, szString, lstrlen (szString), &size) ;
  23.  
  24.      BeginPath (hdc) ;
  25.      TextOut (hdc, (cxArea - size.cx) / 2, (cyArea - size.cy) / 2,
  26.                     szString, lstrlen (szString)) ;
  27.      EndPath (hdc) ;
  28.  
  29.      StrokePath (hdc) ;
  30.  
  31.      SelectObject (hdc, GetStockObject (SYSTEM_FONT)) ;
  32.      DeleteObject (hFont) ;
  33. }
  34.